﻿// See http://ocsigen.org/docu/1.2.0/XHTML.M.html - glöm inte att tacka för inspirationen!

namespace WingBeats.Xhtml.D

type cdata = string

type id = string

type idref = string

type idrefs = idref list

type nmtoken = string

type character = char

and charset = 
    | OtherSet of string
    | Utf8
    | StandardLatin
    override x.ToString() =
        match x with
        | OtherSet s    -> s
        | StandardLatin -> "ISO-8859-1"
        | Utf8          -> "UTF-8"

type charsets = charset list

type color = 
       | Aqua
       | Black
       | Blue
       | Fuchsia
       | Gray
       | Green
       | Hex of string
       | Lime
       | Maroon
       | Navy
       | Olive
       | Purple
       | RGB of int * int * int
       | Red
       | Silver
       | Teal
       | White
       | Yellow
       
type contentType = string

type contentTypes = contentType list

type coords = int list 

type dateTime = System.DateTime

type fpi = string

type frametarget = string

type languagecode =
    | LangCode of string
    | GbEnglish
    | UsEnglish
    | English
    | Swedish
    override x.ToString() =
        match x with
        | LangCode s -> s
        | GbEnglish  -> "en-GB"
        | UsEnglish  -> "en-US"
        | English    -> "en"
        | Swedish    -> "se"

type length = cdata

and multiLength = 
    | Pixels of int 
    | Percent of int 
    | RelativeLength of int
    override x.ToString() =
        match x with
        | Percent        p -> sprintf "%d%%" p
        | Pixels         p -> p.ToString()
        | RelativeLength r -> sprintf "%d*" r

type linkTypesMember = 
    | Alternate
    | Appendix
    | Bookmark
    | Chapter
    | Contents
    | Copyright
    | Glossary
    | Help
    | Index
    | Next
    | Other of string
    | Prev
    | Section
    | Start
    | Stylesheet
    | Subsection
    override x.ToString() =
        match x with
        | Alternate  -> "alternate"
        | Appendix   -> "appendix"
        | Bookmark   -> "bookmark"
        | Chapter    -> "chapter"
        | Contents   -> "contents"
        | Copyright  -> "copyright"
        | Glossary   -> "glossary"
        | Help       -> "help"
        | Index      -> "index"
        | Next       -> "next"
        | Other s    -> s
        | Prev       -> "prev"
        | Section    -> "section"
        | Start      -> "start"
        | Stylesheet -> "stylesheet"
        | Subsection -> "subsection"
    
type linkTypes = linkTypesMember list

type mediaDescMember = 
    | All
    | Aural
    | Braille
    | Handheld
    | Print
    | Projection
    | Screen
    | TTY
    | TV
    override x.ToString() =
        match x with
        | All        -> "all"
        | Aural      -> "aural"
        | Braille    -> "braille"
        | Handheld   -> "handheld"
        | Print      -> "print"
        | Projection -> "projection"
        | Screen     -> "screen"
        | TV         -> "tv"
        | TTY        -> "tty"
    
type mediaDesc = mediaDescMember list

type number = int

type pixels = int

type script = string

type text = string

type uri = 
    | Url of string
    | XhtmlNS
    override x.ToString() =
        match x with
        | XhtmlNS -> "http://www.w3.org/1999/xhtml"
        | Url s   -> s

// These are mine

and shape = 
    | Default 
    | Rect 
    | Circle 
    | Poly
    override x.ToString() =
        match x with
        | Default -> "default"
        | Rect    -> "rect"
        | Circle  -> "circle"
        | Poly    -> "poly"

and textdir = 
    | Rtl
    | Ltr
    override x.ToString() =
        match x with
        | Ltr -> "ltr"
        | Rtl -> "rtl"
              
and inputType = 
    | Button 
    | CheckBox 
    | File 
    | Hidden 
    | Image 
    | Password 
    | Radio
    | Reset
    | Submit
    | Text
    override x.ToString() =
        match x with
        | Button   -> "button"
        | CheckBox -> "checkbox"
        | File     -> "file"
        | Hidden   -> "hidden"
        | Image    -> "image"
        | Password -> "password"
        | Radio    -> "radio"
        | Reset    -> "reset"
        | Submit   -> "submit"
        | Text     -> "text"

and buttonType = 
    | Button
    | Submit
    | Reset
    override x.ToString() =
        match x with
        | Button  -> "button"
        | Reset   -> "reset"
        | Submit  -> "submit"

and cellHAlign = 
    | Left // dtd: cellhalign?
    | Right 
    | Center 
    | Justify 
    | Character
    override x.ToString() =
        match x with
        | Center    -> "center"
        | Character -> "char"
        | Justify   -> "justify"
        | Left      -> "left"
        | Right     -> "right"

and cellVAlign = 
    | Top // dtd: cellvalign?
    | Middle 
    | Bottom 
    | Baseline
    override x.ToString() =
        match x with
        | Baseline -> "baseline"
        | Bottom   -> "bottom"
        | Middle   -> "middle"
        | Top      -> "top"
                 
and encType =
    | Encoded 
    | NotEncoded 
    | SpacesToPlus
    override x.ToString() =
        match x with
        | Encoded      -> "application/x-www-form-urlencoded"
        | NotEncoded   -> "multipart/form-data" // this is for file uploads. why is it called "not encoded"?
        | SpacesToPlus -> "text/plain"  // I don't get what this name has to do with text/plain.

and formMethod = 
    | Get 
    | Post
    override x.ToString() =
        match x with
        | Get  -> "get"
        | Post -> "post"

and httpEquiv = 
    | Allow
    | ContentEncoding
    | ContentLength
    | ContentType
    | Date
    | Expires
    | LastModified
    | Location
    | Refresh // do not use
    | SetCookie
    | WwwAuthenticate
    override x.ToString() =
        match x with
        | Allow           -> "Allow"
        | ContentEncoding -> "Content-Encoding"
        | ContentLength   -> "Content-Length"
        | ContentType     -> "Content-Type"
        | Date            -> "Date"
        | Expires         -> "Expires"
        | LastModified    -> "Last-Modified"
        | Location        -> "Location"
        | Refresh         -> "Refresh"
        | SetCookie       -> "Set-Cookie"
        | WwwAuthenticate -> "WWW-Authenticate"

and metaName = 
    | Author 
    | Copyright
    | Description
    | Distribution
    | Generator
    | Keywords
    | ProgID
    | Rating
    | ResourceType
    | RevisitAfter
    | Robots
    | Other of string
    override x.ToString() =
        match x with
        | Author       -> "author"
        | Copyright    -> "copyright"
        | Description  -> "description"
        | Distribution -> "distribution"
        | Generator    -> "generator"
        | Keywords     -> "keywords"
        | Other s      -> s
        | ProgID       -> "progid"
        | Rating       -> "rating"
        | ResourceType -> "resource-type"
        | RevisitAfter -> "revisit-after"
        | Robots       -> "robots" 

and valueType = 
    | Data 
    | Ref 
    | Object
    override x.ToString() =
        match x with
        | Data   -> "data"
        | Object -> "object"
        | Ref    -> "ref"

and tFrame = 
    | Void  // dtd: TFrame
    | Above 
    | Below 
    | HSides 
    | VSides 
    | Lhs 
    | Rhs
    | Box
    | Border
    override x.ToString() =
        match x with
        | Above  -> "above"
        | Below  -> "below"
        | Border -> "border"
        | Box    -> "box"
        | HSides -> "hsides"
        | Lhs    -> "lhs"
        | Rhs    -> "rhs"
        | VSides -> "vsides"
        | Void   -> "void"

and tRules = 
    | None // dtd: TRules
    | Groups
    | Rows
    | Cols
    | All
    override x.ToString() =
        match x with
        | All    -> "all"
        | Cols   -> "cols"
        | Groups -> "groups"
        | None   -> "none"
        | Rows   -> "rows"

and scope = 
    | Col
    | ColGroup
    | Row
    | RowGroup
    override x.ToString() =
        match x with
        | Col      -> "col"
        | ColGroup -> "colgroup"
        | Row      -> "row"
        | RowGroup -> "rowgroup"
